const fp = require("lodash/fp")
const { Maybe, Container } = require("./support")
let maybe = Maybe.of([5, 6, 1])
//ex1
let ex1 = (values) => {
    return fp.map(function (i) {
        return fp.add(i, 1)
    }, values)
}
console.log(maybe.map(ex1));
//ex2
let xs = Container.of(["do", "ray", "me", "fa", "so", "la", "ti", "do"])
let ex2 = (values) => {
    // console.log(xs._value);
    return fp.first(values)
}
console.log(xs.map(ex2));
//ex3
let safeProp = fp.curry(function (x, o) {
    return Maybe.of(o[x])
})
let user = { id: 2, name: "Albert" }
let ex3 = () => {
    return safeProp(0)(user.name)
}
console.log(ex3());

//ex4
// let ex4 = function (n) {
//     if (n) {
//         return parseInt(n)
//     }
// }
let ex4 = function (n) {
    return Maybe.of(n).map((value) => {
        return parseInt(value)
    })
}
console.log(ex4(undefined));